<template>
  <div>
    <Contentheader :headerInfo="headerInfo" />

    <el-card>
      <template>
        <el-table
          :data="userList"
          tooltip-effect="dark"
          @selection-change="handleSelectionChange"
        >
          <el-table-column type="selection"> </el-table-column>
          <el-table-column prop="id" label="ID"> </el-table-column>
          <el-table-column prop="Username" label="用户名"> </el-table-column>
          <el-table-column prop="Realname" label="真实姓名"> </el-table-column>
          <el-table-column prop="Phone" label="电话"> </el-table-column>
          <el-table-column prop="Type" label="类型"> </el-table-column>
          <el-table-column prop="date" label="注册时间"> </el-table-column>
          <el-table-column label="操作" width="200px">
            <template slot-scope="">
              <el-link type="primary">重置密码</el-link>
              <el-link class="btndel" type="danger">删除</el-link>
            </template>
          </el-table-column>
        </el-table>
      </template>
    </el-card>
  </div>
</template>

<script>
import { mapState } from "vuex";
import Contentheader from "@/components/Contentheader";
export default {
  name: "Usermanage",
  components: { Contentheader },
  data() {
    return {
      // Contentheader组件的数据
      headerInfo: {
        title: "用户信息管理",
        rightInfo: {
          iptMessage: "请输入用户名",
        },
      },
    };
  },
  mounted() {
    // 通知Vuex向axios发送请求获取数据
    this.$store.dispatch("usermanage/getUserLists");
  },
  computed: {
    ...mapState("usermanage", ["userList"]),
  },
  methods: {
    //全选按钮
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
  },
};
</script>

<style lang="less" scoped>
.el-card {
  margin-top: 20px;
  .btndel {
    margin-left: 10px;
  }
}
</style>
